    //
//  DBActionMenuController.m
//  Pods
//
//  Created by Jocer on 2017/8/17.
//
//

#import "DBActionMenuController.h"
#import "DBDeviceHardwareController.h"
#import "DBNetworkSnifferController.h"
#import "DBCrashHandlerController.h"
#import "DBNetworkLogController.h"

@interface DBActionMenuController ()
@property (assign, nonatomic, readonly) NSInteger normalSelectedIndex;
@property (assign, nonatomic, readonly) NSInteger h5SelectedIndex;
@end

@implementation DBActionMenuController

- (void)initDataSource {
    QMUIStaticTableViewCellDataSource *dataSource = [[QMUIStaticTableViewCellDataSource alloc] initWithCellDataSections:@[
  @[({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 1;
        d.style = UITableViewCellStyleSubtitle;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeNone;
        d.didSelectTarget = self;
        d.didSelectAction = @selector(displayAPIDomainList);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"API Domain";
        d.detailText = [DebugManager currentDomainWithType:APIDomainTypeDefault]?:@"Not Set";
        d;
    }),
    ({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 2;
        d.style = UITableViewCellStyleSubtitle;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeNone;
        d.didSelectTarget = self;
        d.didSelectAction = @selector(displayH5APIDomainList);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"H5-API Domain";
        d.detailText = [DebugManager currentDomainWithType:APIDomainTypeH5]?:@"Not Set";
        d;
    }),
    ({
        //hulinhua
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 3;
        d.style = UITableViewCellStyleSubtitle;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeNone;
        d.didSelectTarget = self;
        d.didSelectAction = @selector(displayNewAPIDomainList);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"New API Domain";
        d.detailText = [DebugManager currentDomainWithType:APIDomainTypeNew]?:@"Not Set";
        d;
    })
  ],
  @[({
      QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
      d.identifier = 3;
      d.style = UITableViewCellStyleSubtitle;
      d.accessoryType = QMUIStaticTableViewCellAccessoryTypeDisclosureIndicator;
      d.didSelectTarget = self;
      d.didSelectAction = @selector(displayNetworkLog);
      d.height = TableViewCellNormalHeight + 6;
      d.text = @"BI LOG";
      d.detailText = @"Keep the latest 100 Network records";
      d;
  })],
  @[({
      QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
      d.identifier = 3;
      d.style = UITableViewCellStyleSubtitle;
      d.accessoryType = QMUIStaticTableViewCellAccessoryTypeDisclosureIndicator;
      d.didSelectTarget = self;
      d.didSelectAction = @selector(displayDeviceHardwareDetails);
      d.height = TableViewCellNormalHeight + 6;
      d.text = @"Device Hardware";
      d.detailText = @"Click to view details";
      d;
  })],
  @[({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 4;
        d.style = UITableViewCellStyleDefault;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeSwitch;
        d.accessoryValueObject = @([DebugManager isDisplayBorderEnabled]);
        d.accessoryTarget = self;
        d.accessoryAction = @selector(displayBorderForAllVisibleViews:);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Display debug mask view for all visible views";
        d;
    }),
    ({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 5;
        d.style = UITableViewCellStyleSubtitle;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeDisclosureIndicator;
        d.didSelectAction = @selector(displayNetworkSniffer);
        d.didSelectTarget = self;
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Display network sniffer";
        d.detailText = @"Keep the latest 50 historical records";
        d;
    }),
    ({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 5;
        d.style = UITableViewCellStyleSubtitle;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeDisclosureIndicator;
        d.didSelectAction = @selector(displayCrashHandler);
        d.didSelectTarget = self;
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Display crash asserts & stacks";
        d.detailText = @"Keep the latest 50 historical records";
        d;
    }),
    ({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 6;
        d.style = UITableViewCellStyleDefault;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeNone;
        d.didSelectTarget = self;
        d.didSelectAction = @selector(displayH5TestFiled);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Test Custom H5-WebView";
        d;
    }),
    ({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 7;
        d.style = UITableViewCellStyleSubtitle;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeDisclosureIndicator;
        d.didSelectTarget = self;
        d.didSelectAction = @selector(displayShortcutActions);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Shortcut";
        d.detailText = @"Display custom shortcut actions";
        d;
    }),
    ({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 8;
        d.style = UITableViewCellStyleSubtitle;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeDisclosureIndicator;
        d.didSelectTarget = self;
        d.didSelectAction = @selector(displayActivityTimeSetter);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Activity Interval Time Setter";
        d.detailText = @"Set activity time as 1 day, default 86400 seconds.";
        d;
    }),
    ({
          QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
          d.identifier = 4;
          d.style = UITableViewCellStyleDefault;
          d.accessoryType = QMUIStaticTableViewCellAccessoryTypeSwitch;
          d.accessoryValueObject = @([DebugManager rnUpdateEnable]);
          d.accessoryTarget = self;
          d.accessoryAction = @selector(rnHotUpdateVisibleViews:);
          d.height = TableViewCellNormalHeight + 6;
          d.text = @"RN Hot Update enable";
          d;
      }),
  ],
  @[({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 8;
        d.style = UITableViewCellStyleDefault;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeSwitch;
        d.accessoryValueObject = @([DebugManager isDebugBallAutoHidden]);
        d.accessoryTarget = self;
        d.accessoryAction = @selector(enableDebugBallAutoHidden:);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Enable auto-hidden for the DebugBall";
        d;
    }),
    ({
        QMUIStaticTableViewCellData *d = [[QMUIStaticTableViewCellData alloc] init];
        d.identifier = 9;
        d.style = UITableViewCellStyleDefault;
        d.accessoryType = QMUIStaticTableViewCellAccessoryTypeSwitch;
        d.accessoryValueObject = @([DebugManager isDebugBallAutoHidden]);
        d.accessoryTarget = self;
        d.accessoryValueObject = @(NO);
        d.accessoryAction = @selector(dimissDebugBallUntilRelaunch:);
        d.height = TableViewCellNormalHeight + 6;
        d.text = @"Dismiss debug-ball until application relaunch";
        d;
    })]]];
    self.tableView.qmui_staticCellDataSource = dataSource;
    self.sectionTitles = @[@"API Configuration", @"BI LOG", @"Device Hardware", @"Tools", @"DebugBall Configuration"];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    self.tableView.qmui_staticCellDataSource.cellDataSections[0][APIDomainTypeDefault].detailText = [DebugManager currentDomainWithType:APIDomainTypeDefault];
    self.tableView.qmui_staticCellDataSource.cellDataSections[0][APIDomainTypeH5].detailText = [DebugManager currentDomainWithType:APIDomainTypeH5];
    self.tableView.qmui_staticCellDataSource.cellDataSections[0][APIDomainTypeNew].detailText = [DebugManager currentDomainWithType:APIDomainTypeNew];
    
    NSIndexPath *index_0 = [NSIndexPath indexPathForRow:APIDomainTypeDefault inSection:0];
    NSIndexPath *index_1 = [NSIndexPath indexPathForRow:APIDomainTypeH5 inSection:0];
     NSIndexPath *index_2 = [NSIndexPath indexPathForRow:APIDomainTypeNew inSection:0];
    [self reloadIndexPaths:@[index_0, index_1 ,index_2]];
}

- (NSInteger)domainSelectedIndex:(APIDomainType)type {
    NSArray *list = [DebugManager domainListWithType:type];
    NSString *domain = [DebugManager currentDomainWithType:type];
    if (!domain || list.count==0) {
        return -1;
    } else if ([list containsObject:domain]) {
        return [list indexOfObject:domain];
    }
    return -1;
}

- (NSInteger)normalSelectedIndex {
    NSArray *list = [DebugManager domainListWithType:APIDomainTypeDefault];
    NSString *domain = [DebugManager currentDomainWithType:APIDomainTypeDefault];
    if (!domain || list.count==0) {
        return -1;
    } else if ([list containsObject:domain]) {
        return [list indexOfObject:domain];
    }
    return -1;
}

- (NSInteger)h5SelectedIndex {
    NSArray *list = [DebugManager domainListWithType:APIDomainTypeH5];
    NSString *domain = [DebugManager currentDomainWithType:APIDomainTypeH5];
    if (!domain || list.count==0) {
        return -1;
    } else if ([list containsObject:domain]) {
        return [list indexOfObject:domain];
    }
    return -1;
}

-(NSString*)getDialogTitleStr:(APIDomainType)type{
    if (type == APIDomainTypeDefault) {
        return @"API Domain List";
    }else if (type == APIDomainTypeH5){
        return @"H5 API Domain List";
    }else{
        return @"New API Domain List";
    }
}
-(NSString*)getNotificationKey:(APIDomainType)type{
    if(type == APIDomainTypeDefault){
        return kAPIHostDidChangedNotification;
    }
    else if (type == APIDomainTypeH5){
        return kH5APIHostDidChangedNotification;
    }else if (type == APIDomainTypeNew){
        return kNewAPIHostDidChangedNotification;
    }else {
        return @"kk";// 就不应该走到这里，只是为了防止crash，不用管，没有业务逻辑
    }
}

#pragma mark - 重要，切换api的触发通知方法
-(void)apiChangeNotif:(APIDomainType)type notifData:(NSDictionary*)info{
    NSString *keyStr = [self getNotificationKey:type];
    [DebugManager setNeedpushNoticationWithData:@{keyStr:info}];
    [DebugManager setNeedpushNoticationWithData:@{kAllAPIHostDidChangedNotification:info}];
}

- (void)displayAPIDomainListWithType:(APIDomainType)type {
    NSIndexPath *currentIdx = [NSIndexPath indexPathForRow:type inSection:0];
    NSMutableArray *list = [[DebugManager domainListWithType:type] mutableCopy];
    [list addObject:type == APIDomainTypeH5 ? @"Add an new h5-domain":@"Add an new domain"];
    QMUIDialogSelectionViewController *dialogViewController = [[QMUIDialogSelectionViewController alloc] init];
    dialogViewController.title = [self getDialogTitleStr:type];
    dialogViewController.tableView;
    dialogViewController.items = list;
    dialogViewController.selectedItemIndex = [self domainSelectedIndex:type];
    [dialogViewController addCancelButtonWithText:@"Cancel" block:nil];
    dialogViewController.cellForItemBlock = ^(QMUIDialogSelectionViewController *dialogViewController, QMUITableViewCell *cell, NSUInteger itemIndex) {
        if (itemIndex == dialogViewController.items.count-1) {
            cell.textLabel.textColor = cell.textLabel.textColor = UIColorMake(93, 100, 110);
            cell.textLabel.font = UIFontBoldMake(15);
        } else {
            cell.textLabel.textColor = cell.textLabel.textColor = UIColorMake(133, 140, 150);
            cell.textLabel.font = UIFontMake(15);
        }
    };
    [dialogViewController addSubmitButtonWithText:@"Confirm" block:^(QMUIDialogViewController *aDialogViewController) {
        QMUIDialogSelectionViewController *d = (QMUIDialogSelectionViewController *)aDialogViewController;
        WEAK_SELF
        if (d.selectedItemIndex == QMUIDialogSelectionViewControllerSelectedItemIndexNone) {
            [QMUITips showError:@"Select at least one domain please" inView:d.qmui_modalPresentationViewController.view hideAfterDelay:1.2];
            return;
        } else if (d.selectedItemIndex == d.items.count-1) {
            [d hideWithAnimated:YES completion:^(BOOL finished) {
                QMUIDialogTextFieldViewController *newAddDialog = [[QMUIDialogTextFieldViewController alloc] init];
            
                [newAddDialog.titleView setTitle:type == APIDomainTypeH5 ? @"Enter an new h5-domain here" : @"Enter an new domain here" ];
                [newAddDialog addTextFieldWithTitle:nil configurationHandler:^(QMUILabel * _Nonnull titleLabel, QMUITextField * _Nonnull textField, CALayer * _Nonnull separatorLayer) {
                    textField.placeholder = list[d.selectedItemIndex];
                }];
                
                [newAddDialog addCancelButtonWithText:@"Cancel" block:nil];
                [newAddDialog addSubmitButtonWithText:@"Confirm" block:^(QMUIDialogViewController *newAddDialog) {
                    STRONG_SELF
                    QMUIDialogTextFieldViewController *nd = (QMUIDialogTextFieldViewController *)newAddDialog;
                    [DebugManager addNewDomain:nd.textFields.firstObject.text domainType:type];
                    NSMutableDictionary *info = [@{kAPIHostDidChangedNewValue:nd.textFields.firstObject.text} mutableCopy];
                    NSInteger selectedIdx = [self domainSelectedIndex:type];
                    if ( selectedIdx != -1) {
                        info[kAPIHostDidChangedOldValue]=d.items[selectedIdx];
                    }
//                    if (type == APIDomainTypeDefault && self.normalSelectedIndex!=-1) {
//                        info[kAPIHostDidChangedOldValue] = d.items[self.normalSelectedIndex];
//                    } else if (self.h5SelectedIndex!=-1) {
//                        info[kAPIHostDidChangedOldValue] = d.items[self.h5SelectedIndex];
//                    }
                    [self apiChangeNotif:type notifData:info];
                    [DebugManager setCurrentDomain:nd.textFields.firstObject.text type:type];
                    self.tableView.qmui_staticCellDataSource.cellDataSections[0][type].detailText = nd.textFields.firstObject.text;
                    [self reloadIndexPaths:@[currentIdx]];
                    [nd hide];
                }];
                [newAddDialog show];
            }];
        } else {
            STRONG_SELF
            NSString *domain = d.items[d.selectedItemIndex];
            NSMutableDictionary *info = [@{kAPIHostDidChangedNewValue:domain} mutableCopy];
            NSInteger selectedIdx = [self domainSelectedIndex:type];
            if ( selectedIdx != -1) {
                info[kAPIHostDidChangedOldValue]=d.items[selectedIdx];
            }
            
//            if (type == APIDomainTypeDefault && self.normalSelectedIndex!=-1) {
//                info[kAPIHostDidChangedOldValue] = d.items[self.normalSelectedIndex];
//            } else if (self.h5SelectedIndex!=-1) {
//                info[kAPIHostDidChangedOldValue] = d.items[self.h5SelectedIndex];
//            }
            [self apiChangeNotif:type notifData:info];
            [DebugManager setCurrentDomain:domain type:type];
            WEAK_SELF
            [aDialogViewController hideWithAnimated:YES completion:^(BOOL finished) {
                STRONG_SELF
                self.tableView.qmui_staticCellDataSource.cellDataSections[0][type].detailText = domain;
                [self reloadIndexPaths:@[currentIdx]];
            }];
        }
    }];
    [dialogViewController show];
}

#pragma mark -- Action Handler

- (void)displayAPIDomainList {
    [self displayAPIDomainListWithType:APIDomainTypeDefault];
}

- (void)displayNewAPIDomainList {
    [self displayAPIDomainListWithType:APIDomainTypeNew];
}

- (void)displayH5APIDomainList {
    [self displayAPIDomainListWithType:APIDomainTypeH5];
}

- (void)displayNetworkLog {
    DBNetworkLogController *controller = [[DBNetworkLogController alloc] init];
    controller.title = @"BI LOG";
    [self.navigationController pushViewController:controller animated:YES];
}

- (void)displayDeviceHardwareDetails {
    DBDeviceHardwareController *vc = [[DBDeviceHardwareController alloc] initWithStyle:UITableViewStyleGrouped];
    vc.navigationItem.title = @"Device Hardware";
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)rnHotUpdateVisibleViews:(UISwitch *)view {
    [DebugManager saveRnUpdateEnable:view.isOn];
}

- (void)displayBorderForAllVisibleViews:(UISwitch *)view {
    [DebugManager saveDisplayBorderEnabled:view.isOn];
    [[NSNotificationCenter defaultCenter] postNotificationName:kDisplayBorderEnabled object:@(view.isOn)];
}

- (void)displayNetworkSniffer {
    DBNetworkSnifferController *controller = [[DBNetworkSnifferController alloc] initWithStyle:UITableViewStylePlain];
    controller.title = @"Network Sniffer";
    [self.navigationController pushViewController:controller animated:YES];
}

- (void)displayCrashHandler {
    DBCrashHandlerController *controller = [[DBCrashHandlerController alloc] initWithStyle:UITableViewStylePlain];
    controller.title = @"Crash Sniffer";
    [self.navigationController pushViewController:controller animated:YES];
}

- (void)displayH5TestFiled {
    QMUIDialogTextFieldViewController *newAddDialog = [[QMUIDialogTextFieldViewController alloc] init];
    
    [newAddDialog.titleView setTitle:@"Enter an new web url here"];
    [newAddDialog addTextFieldWithTitle:nil configurationHandler:^(QMUILabel * _Nonnull titleLabel, QMUITextField * _Nonnull textField, CALayer * _Nonnull separatorLayer) {
        textField.placeholder = @"e.g.https://m.azazie.com/";
    }];

    WEAK_SELF
    [newAddDialog addCancelButtonWithText:@"Cancel" block:nil];
    [newAddDialog addSubmitButtonWithText:@"Confirm" block:^(QMUIDialogViewController *newAddDialog) {
        STRONG_SELF
        QMUIDialogTextFieldViewController *nd = (QMUIDialogTextFieldViewController *)newAddDialog;
        if (self.webViewAction) self.webViewAction(nd.textFields.firstObject.text);
        [nd hide];
    }];
    [newAddDialog show];
}

- (void)displayShortcutActions {
    QMUIDialogSelectionViewController *dialogViewController = [[QMUIDialogSelectionViewController alloc] init];
    dialogViewController.title = @"Shortcuts(You must ever have logged in)";
    dialogViewController.items = @[@"Log in using the account you'd ever logged in",
                                   @"Log out",
                                   @"Invalidate current access token",
                                   @"Log in using the account you'd ever logged in and invalidate the `Access Token` immediately"];
    dialogViewController.cellForItemBlock = ^(QMUIDialogSelectionViewController *aDialogViewController, QMUITableViewCell *cell, NSUInteger itemIndex) {
        cell.accessoryType = UITableViewCellAccessoryNone;
        cell.textLabel.textColor = UIColorMake(93, 100, 110);
        cell.textLabel.font = UIFontMake(15);
        cell.textLabel.numberOfLines = 0;
    };
    dialogViewController.heightForItemBlock = ^CGFloat(QMUIDialogSelectionViewController *aDialogViewController, NSUInteger itemIndex) {
        if (itemIndex == 0) {
            return 60.f;
        } else if (itemIndex == 3) {
            return 70.f;
        } else {
            return 40.f;
        }
    };
    dialogViewController.didSelectItemBlock = ^(QMUIDialogSelectionViewController *aDialogViewController, NSUInteger itemIndex) {
        if (itemIndex == 0) {
            if (self.loginAction)
                self.loginAction(UserDefaultsObjectForKey(DBACCOUNT_EMAIL_KEY), UserDefaultsObjectForKey(DBACCOUNT_PASSWORD_KEY));
        } else if (itemIndex == 1) {
            if (self.logoutAction) self.logoutAction();
        } else if (itemIndex == 2) {
            if (self.invalidateTokenAction) self.invalidateTokenAction();
        } else if (itemIndex == 3) {
            if (self.invalidateTokenAfterLoginAction) self.invalidateTokenAfterLoginAction(UserDefaultsObjectForKey(DBACCOUNT_EMAIL_KEY), UserDefaultsObjectForKey(DBACCOUNT_PASSWORD_KEY));
        }
        [aDialogViewController hide];
    };
    
    [dialogViewController addCancelButtonWithText:@"Cancel" block:nil];
    
    [dialogViewController show];
}

- (void)displayActivityTimeSetter {
    QMUIDialogTextFieldViewController *newAddDialog = [[QMUIDialogTextFieldViewController alloc] init];
    
    [newAddDialog.titleView setTitle:@"Activity Interval Time Setter"];
    [newAddDialog addTextFieldWithTitle:nil configurationHandler:^(QMUILabel * _Nonnull titleLabel, QMUITextField * _Nonnull textField, CALayer * _Nonnull separatorLayer) {
        textField.placeholder = @"??? seconds as 1 day.";
        textField.text = [NSString stringWithFormat:@"%d", [[[NSUserDefaults standardUserDefaults] objectForKey:@"defaultTimeSpace"] integerValue]];
    }];
    
    [newAddDialog addCancelButtonWithText:@"Cancel" block:nil];
    [newAddDialog addSubmitButtonWithText:@"Confirm" block:^(QMUIDialogViewController *kNewAddDialog) {
        [[NSUserDefaults standardUserDefaults] setObject:@([newAddDialog.textFields.firstObject.text integerValue]) forKey:@"defaultTimeSpace"];
        [[NSUserDefaults standardUserDefaults] synchronize];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"AZActivityTimeSpaceChanged" object:nil];
        [newAddDialog hideWithAnimated:YES completion:NULL];
    }];
    [newAddDialog show];
}

- (void)enableDebugBallAutoHidden:(UISwitch *)view {
    [DebugManager setDebugBallAutoHidden:view.isOn];
    [DebugManager resetDebugBallAutoHidden];
}

- (void)dimissDebugBallUntilRelaunch:(UISwitch *)view {
    [DebugManager uninstallDebugView];
}

- (void)dealloc {
    
}

#pragma mark -- Private Method

- (void)reloadIndexPaths:(NSArray <NSIndexPath *> *)indexPaths {
    [self.tableView beginUpdates];
    [self.tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
    [self.tableView endUpdates];
}

#pragma mark -- Override Method

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    QMUITableViewCell *cell = [tableView.qmui_staticCellDataSource cellForRowAtIndexPath:indexPath];
    cell.textLabel.textColor = UIColorMake(93, 100, 110);
    cell.detailTextLabel.textColor = UIColorMake(133, 140, 150);
    cell.textLabel.font = UIFontMake(15);
    cell.detailTextLabel.font = UIFontMake(13);
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView.qmui_staticCellDataSource didSelectRowAtIndexPath:indexPath];
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

@end
